import service from "@/services/request";

/**
 * 统一封装 请求入口
 * @param option
 * @returns {*}
 */
const request = (option) => {
    const {url, method, params, data, headersType, responseType, headers = {}, ...config} = option;
    return service({
        url: url,
        method,
        params,
        data,
        ...config,
        responseType: responseType,
        headers: Object.assign({}, headers),
    });
};
export default {
    get: async (option) => {
        const res = await request({method: "GET", ...option});
        return res;
    },
    post: async (option) => {
        const res = await request({method: "POST", ...option});
        return res;
    }
};
